import request from '@/config/axios'

// 题库-SPU VO
export interface BankSpuVO {
  id: number // 主键
  bankId: number // 题库ID
  name: string // 名称
  detail: string // 明细
  mainImg: string // 主图
  price: number // 单价
  expireTime: number // 过期时间
  status: string // 状态: 是否销售
}

// 题库-SPU API
export const BankSpuApi = {
  // 查询题库-SPU分页
  getBankSpuPage: async (params: any) => {
    return await request.get({ url: `/exam/bank-spu/page`, params })
  },

  // 查询题库-SPU详情
  getBankSpu: async (id: number) => {
    return await request.get({ url: `/exam/bank-spu/get?id=` + id })
  },

  // 新增题库-SPU
  createBankSpu: async (data: BankSpuVO) => {
    return await request.post({ url: `/exam/bank-spu/create`, data })
  },

  // 修改题库-SPU
  updateBankSpu: async (data: BankSpuVO) => {
    return await request.put({ url: `/exam/bank-spu/update`, data })
  },

  // 删除题库-SPU
  deleteBankSpu: async (id: number) => {
    return await request.delete({ url: `/exam/bank-spu/delete?id=` + id })
  },

  // 导出题库-SPU Excel
  exportBankSpu: async (params) => {
    return await request.download({ url: `/exam/bank-spu/export-excel`, params })
  }
}